package sms.test;

import org.junit.Test;
import sms.MiddleStudent;
import sms.PrimaryStudent;
import sms.StudentManagementSystem03;

import java.time.LocalDate;

public class SMSTest03 {
    private StudentManagementSystem03 sms = new StudentManagementSystem03();

    @Test
    public void setPropertyValue() throws NoSuchFieldException, IllegalAccessException {
        PrimaryStudent ps = new PrimaryStudent(20241316, "小新", 77, 81
                , LocalDate.parse("2013-10-12"), "233434@qq.com");

        sms.setPropertyValue(ps, "name", "小小新");
        System.out.println(sms.getPropertyValue(ps, "name"));
    }

    @Test
    public void getPropertyValue() throws NoSuchFieldException, IllegalAccessException {
        PrimaryStudent ps = new PrimaryStudent(20241316, "小新", 77, 81
                , LocalDate.parse("2013-10-12"), "233434@qq.com");

        System.out.println(sms.getPropertyValue(ps,"name"));
    }

    @Test
    public void getPropertyValue02() throws NoSuchFieldException, IllegalAccessException {
        MiddleStudent ms = new MiddleStudent(20241333, "大花", 60, 64
                , LocalDate.parse("2023-10-15"), "23343423@qq.com",78,91);

        System.out.println(sms.getPropertyValue(ms,"studentId"));
    }
}